class ProjectsController < ApplicationController

  def index
    @objects = Project.find(:all)
    @new_object = Project.new
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @objects }
    end
  end

  def create
    @object = Project.new(params[:project])
    @new_object = Project.new
    @object.save
    respond_to do |format|
        format.js { render :partial => 'layouts/object_view/create.rjs' }
    end
  end

  def edit
    @object = Project.find(params[:object_id])
    respond_to do |format|
        format.js { render :partial => 'layouts/object_view/edit.rjs' }
    end    
  end

  def update
    @object = Project.find(params[:id])
    @object.update_attributes(params[:project])
    respond_to do |format|
      format.js { render :partial => 'layouts/object_view/update.rjs' }
    end
  end

  def destroy                  
    @object = Project.find(params[:object_id])
    @object.destroy
    respond_to do |format|
      format.js { render :partial => 'layouts/object_view/destroy.rjs' }
    end
  end
end
